<script lang="ts" setup>
import useLotNewsLive, {
  useLotNewsLiveRefs
} from "@/components/NewsLive/composables/useLotNewsLive";
import useLckNum, { useLckNumRefs } from "../hooks/useLckNum";
const { onRefresh } = useLckNum();
const { refreshing } = useLckNumRefs();
const {
  router,
  route,
  loadMoreNews,
  fetchDataByType,
  resetNewsLive,
  setActive
} = useLotNewsLive();
const { lckNewsList, loadLckNewsState } = useLotNewsLiveRefs();
onMounted(() => {
  fetchDataByType(1);
});
resetNewsLive();
const goToDetail = (item: any) => {
  setActive(1);
  resetNewsLive();
  router.push({
    path: `/news/detail/${item.id}`,
    query: { ...route.query }
  });
};
</script>
<template>
  <div class="px-0 py-0">
    <van-pull-refresh
      v-model="refreshing"
      @refresh="onRefresh"
      loosing-text="释放即可刷新..."
      loading-text="加载中..."
      pulling-text="下拉即可刷新..."
    >
      <ContList
        :list="lckNewsList"
        :loadMoreStatus="loadLckNewsState"
        @clickItem="goToDetail"
        @loadmore="loadMoreNews(1)"
      />
    </van-pull-refresh>
  </div>
</template>
